home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 240 (DVD) / Issue 240 - February 2008 - DPCS0208DVD.ISO / Extras / NetObjects Fusion / NOF10.exe / data1.cab / Program_Executable_Files / NetObjects_System / embeddedobjs.js < prev    next >
Encoding:
Text File  |  2007-04-11  |  14.8 KB  |  416 lines

  1. function isHostNetscapeCompatible() {return navigator.mimeTypes.length ? true : false;};
  2.  
  3. function isHostActiveXCompatible() { 
  4.     return window.ActiveXObject ? true : false; 
  5. };
  6.  
  7. createObject = function (mimeType, params){
  8.     switch(mimeType) {
  9.         case "video/quicktime":
  10.             var obj = new QuickTime(mimeType, params);
  11.             document.writeln(obj.toHTML());
  12.             break;
  13.         case "application/asx":
  14.             var obj = new WindowsMediaPlayer(mimeType, params);
  15.             document.writeln(obj.toHTML());
  16.             break;
  17.         case "video/vnd.rn-realvideo":    
  18.             var obj = new WindowsMediaPlayer(mimeType, params);
  19.             document.writeln(obj.toHTML());
  20.             break;            
  21.         case "application/x-shockwave-flash":
  22.             var obj = new FlashPlugin(mimeType, params);
  23.             document.writeln(obj.toHTML());
  24.             break;
  25.         case "application/x-java-bean":
  26.             var obj = new JavaBeansPlugin(mimeType, params);
  27.             document.writeln(obj.toHTML());
  28.             break;        
  29.         case "application/x-java-applet":
  30.             var obj = new JavaAppletPlugin(mimeType, params);
  31.             document.writeln(obj.toHTML());
  32.             break;    
  33.         case "application/x-director":            
  34.             var obj = new ShockwaveDirectorPlugin(mimeType, params);
  35.             document.writeln(obj.toHTML());
  36.             break;            
  37.         }
  38. }
  39.  
  40. /** 
  41.  * QuickTime plugin object
  42.  *
  43.  */
  44. function QuickTime(mimeType, params) {
  45.     this.mimeType = mimeType;
  46.     this.params = params;
  47. }
  48.  
  49.  
  50. /**
  51.  * generates HTML code for Quicktime plugin
  52.  *
  53.  */
  54. QuickTime.prototype.toHTML = function () {
  55.     
  56.   htmlStr = "";
  57.   htmlStr += '<object';
  58.   htmlStr += ' type="' + this.mimeType + '"';
  59.   htmlStr += ' border="' + this.params["border"] + '"';
  60.   htmlStr += ' height="' + this.params["height"] + '"';
  61.   htmlStr += ' width="' + this.params["width"] + '"';
  62.   htmlStr += ' title="' +  this.params["alt"] + '"';
  63.   htmlStr += ' codebase="' + this.params["codebase"] +'"';
  64.   htmlStr += ' classid="' + this.params["classid"] + '"';
  65.   htmlStr += ' style="visibility:' +  this.params["hidden"] + '"';
  66.   htmlStr += '>';  
  67.  
  68.   htmlStr += '\n';   
  69.   htmlStr += '<param name="src" value="' + this.params["src"] + '">\n';
  70.   htmlStr += '<param name="cache" value="' + this.params["cache"] + '">\n';
  71.   htmlStr += '<param name="autoplay" value="' + this.params["autoplay"] + '">\n';
  72.   htmlStr += '<param name="controller" value="' + this.params["controller"] + '">\n';
  73.   htmlStr += '<param name="loop" value="' + this.params["loop"] + '">\n';
  74.  
  75.   htmlStr += '<embed';
  76.   htmlStr += ' src="' + this.params["src"] + '"';
  77.   htmlStr += ' width="' + this.params["width"] + '"';
  78.   htmlStr += ' height="' + this.params["height"] + '"'; 
  79.   htmlStr += ' loop="' + this.params["loop"] + '"';
  80.   htmlStr += ' autoplay="' + this.params["autoplay"] + '"';
  81.   htmlStr += ' pluginspage="http://www.apple.com/quicktime/download/"';
  82.   htmlStr += ' type="' + this.mimeType + '"';
  83.   htmlStr += '></embed>';
  84.   htmlStr += '</object>\n';
  85.   
  86.     return htmlStr;
  87. }
  88.  
  89. /**
  90.  * Windows Media Player object
  91.  *
  92.  */
  93. function WindowsMediaPlayer(mimeType, params){
  94.     this.mimeType = mimeType;
  95.     this.params = params;    
  96. }
  97.  
  98. /**
  99.  * generates HTML code for Windows Media Player plugin
  100.  *
  101.  */
  102. WindowsMediaPlayer.prototype.toHTML = function(){
  103.     htmlStr = "";
  104.     
  105.     htmlStr += '<object name="' + this.params["name"] + '"'; 
  106.     htmlStr += ' border="' + this.params["border"] + '"';
  107.     htmlStr += ' type="' + this.mimeType + '"';
  108.     if (isHostActiveXCompatible()){
  109.         htmlStr += ' classid="' + this.params["classid"] + '"';
  110.     }
  111.  
  112.     htmlStr += ' data="' + this.params["src"] + '" ';
  113.  
  114.     htmlStr += ' height="' + this.params["height"] + '"';
  115.     htmlStr += ' width="' + this.params["width"] + '"';
  116.     htmlStr += ' alt="' + this.params["alt"] + '"';
  117.     htmlStr += ' title="' + this.params["alt"] + '"';
  118.     htmlStr += '>\n'
  119.     
  120.     if(isHostActiveXCompatible()){
  121.         htmlStr += '<param name="src" value="' + this.params["src"] + '">\n';
  122.     }
  123.     
  124.     htmlStr += '<param name="URL" value="' + this.params["src"] + '">\n';
  125.     htmlStr += '<param name="uiMode" value="full">\n';
  126.     htmlStr += '</object>';
  127.     return htmlStr;
  128. }
  129.  
  130. /** 
  131.  * FlashPlugin object
  132.  *
  133.  */
  134. function FlashPlugin(mimeType, params){
  135.     this.mimeType = mimeType;
  136.     this.params = params;
  137. }
  138.  
  139. /**
  140.  * generates HTML code for Windows Media Player plugin
  141.  *
  142.  */
  143. FlashPlugin.prototype.toHTML = function(){
  144.     
  145.     this.params["loop"] = (this.params["loop"] == "1") ? "true" : "false" ;
  146.     this.params["play"] = (this.params["play"] == "1") ? "true" : "false" ;
  147.  
  148.     htmlStr = "";
  149.     
  150.     // special case for Flash Splash Screen component
  151.     if (this.params["isSplashScreen"] == 'true')
  152.     {
  153.         htmlStr += '<object '; 
  154.  
  155.         htmlStr += ' type="application/x-shockwave-flash"' ;
  156.  
  157.         if (isHostActiveXCompatible()){
  158.             htmlStr += ' codebase="' + this.params["codebase"] + '"'; 
  159.             htmlStr += ' classid="' + this.params["classid"] + '"';
  160.         }
  161.         
  162.     if(!isHostActiveXCompatible()){
  163.       htmlStr += ' data="' + this.params["movie"] + '" ';
  164.         }
  165.     
  166.         htmlStr += ' height="' + this.params["height"] + '"';
  167.         htmlStr += ' width="' + this.params["width"] + '"';
  168.         htmlStr += ' alt="' + this.params["alt"] + '"';
  169.         htmlStr += ' title="' + this.params["alt"] + '"';   
  170.         htmlStr += '>'
  171.         
  172.         htmlStr += '\n';
  173.         htmlStr += '<param name="movie" value="' + this.params["movie"] + '"/>\n';
  174.         htmlStr += '<param name="FlashVars" value="' + this.params["flashVars"] + '"/>\n';
  175.         htmlStr += '</object>';
  176.     }
  177.     else
  178.     {
  179.         htmlStr += '<object name="' + this.params["name"] + '"'; 
  180.         
  181.         if (isHostActiveXCompatible()){
  182.             htmlStr += ' codebase="' + this.params["codebase"] + '"'; 
  183.         }
  184.         
  185.         htmlStr += ' type="application/x-shockwave-flash"' ;
  186.         
  187.         if (isHostActiveXCompatible()){
  188.             htmlStr += ' classid="' + this.params["classid"] + '"';
  189.         }
  190.     
  191.         if (!isHostActiveXCompatible()){
  192.       htmlStr += ' data="' + this.params["src"] + '" ';
  193.     }
  194.     
  195.         htmlStr += ' height="' + this.params["height"] + '"';
  196.         htmlStr += ' width="' + this.params["width"] + '"';
  197.         htmlStr += ' alt="' + this.params["alt"] + '"';
  198.         htmlStr += ' title="' + this.params["alt"] + '"';
  199.         htmlStr += '>'
  200.         
  201.         if(isHostActiveXCompatible()){
  202.             htmlStr += '<param name="src" value="' + this.params["src"] + '">\n';
  203.         }
  204.         
  205.         htmlStr += '\n';
  206.         htmlStr += '<param name="movie" value="' + this.params["src"] + '"/>\n';
  207.         htmlStr += '<param name="quality" value="' + this.params["quality"] + '"/>\n';
  208.         htmlStr += '<param name="loop" value="' + this.params["loop"] + '"/>\n';     
  209.         htmlStr += '<param name="scale" value="' + this.params["scale"] + '"/>\n';    
  210.         htmlStr += '<param name="wmode" value="' + this.params["wmode"] + '"/>\n';
  211.         htmlStr += '<param name="salign" value="' + this.params["salign"] + '"/>\n';
  212.         htmlStr += '<param name="bgcolor" value="' + this.params["bgcolor"] + '"/>\n';
  213.  
  214.         htmlStr += '<embed';
  215.         htmlStr += ' src="' + this.params["src"] + '"';
  216.         htmlStr += ' quality="' + this.params["quality"] + '"';
  217.         htmlStr += ' width="' + this.params["width"] + '"';
  218.         htmlStr += ' height="' + this.params["height"] + '"'; 
  219.         htmlStr += ' loop="' + this.params["loop"] + '"';
  220.         htmlStr += ' play="' + this.params["play"] + '"';
  221.         htmlStr += ' wmode="' + this.params["wmode"] + '"';
  222.         htmlStr += ' salign="' + this.params["salign"] + '"';
  223.         htmlStr += ' scale="' + this.params["scale"] + '"';
  224.         htmlStr += ' bgcolor="' + this.params["bgcolor"] + '"';
  225.         htmlStr += ' flashvars="' + this.params["flashVars"] + '"';
  226.         htmlStr += ' pluginspage="http://www.macromedia.com/go/getflashplayer"';
  227.         htmlStr += ' type="application/x-shockwave-flash"';
  228.         htmlStr += '></embed>';   
  229.     
  230.         htmlStr += '</object>';
  231.     }
  232.     return htmlStr;
  233. }
  234.  
  235. /**
  236.  * JavaBeansPlugin object
  237.  *
  238.  */
  239. function JavaBeansPlugin(mimeType, params){
  240.     this.mimeType = mimeType;
  241.     this.params = params;
  242. }
  243.  
  244. /**
  245.  * generates HTML code for the Java plugin
  246.  *
  247.  */
  248. JavaBeansPlugin.prototype.toHTML = function(){
  249.     htmlStr = "";
  250.     
  251.     htmlStr += '<object name="' + this.params["name"] + '"'; 
  252.     htmlStr += 'id="' + this.params["name"] + '"';
  253.     
  254.     if (isHostActiveXCompatible()){
  255.         htmlStr += ' codebase="' + this.params["pluginCodebase"] + '"'; 
  256.     }
  257.     
  258.     htmlStr += ' type="' + this.params["type"] + '"'; 
  259.     
  260.     if (isHostActiveXCompatible()){
  261.         htmlStr += ' classid="' + this.params["classid"] + '"';
  262.     }
  263.  
  264.     htmlStr += ' archive="' + this.params["archive"] + '"';
  265.  
  266.     htmlStr += ' height="' + this.params["height"] + '"';
  267.     htmlStr += ' width="' + this.params["width"] + '"';
  268.     htmlStr += ' alt="' + this.params["alt"] + '"';
  269.     
  270.     if (this.params["isApplet"] == "true")
  271.         htmlStr += ' title="' + this.params["alt"] + '"';
  272.     
  273.     htmlStr += '>\n'
  274.     htmlStr += '<param name="code" value="' + this.params["code"] + '"/>\n';
  275.     htmlStr += '<param name="archive" value="' + this.params["archive"] + '"/>\n';
  276.     htmlStr += '<param name="scriptable" value="' + this.params["scriptable"] + '"/>\n'; //MAYSCRIPT
  277.     htmlStr += '<param name="FiresScriptEvents" value="' + this.params["scriptEvents"] + '"/>\n';
  278.     htmlStr += '<param name="codebase" value="' + this.params["appletCodebase"] + '"/>\n'; 
  279.     htmlStr += '<param name="mayscript" value="' + this.params["mayscript"] + '"/>\n';    
  280.  
  281.     // process custom params
  282.     subParams = this.params["customParams"].split(";");
  283.     for (i = 0; i < subParams.length; i++){
  284.         tempArray = subParams[i].split("|");
  285.         htmlStr += '<param name="' + tempArray[0] + '" value="' + tempArray[1] + '"/>\n';
  286.     }
  287.     
  288.     htmlStr += '</object>';
  289.     return htmlStr;    
  290.     
  291. }
  292.  
  293.  
  294. function JavaAppletPlugin(mimeType, params){
  295.     this.mimeType = mimeType;
  296.     this.params = params;
  297. }
  298.  
  299. /**
  300.  * generates HTML code for the Java Applet plugin
  301.  *
  302.  */
  303. JavaAppletPlugin.prototype.toHTML = function(){
  304.     htmlStr = "";
  305.     
  306.     htmlStr += '<object name="' + this.params["name"] + '"'; 
  307.     htmlStr += ' id="' + this.params["name"] + '"';
  308.     
  309.     if (isHostActiveXCompatible()){
  310.         htmlStr += ' codebase="' + this.params["pluginCodebase"] + '"'; 
  311.     }
  312.     
  313.     htmlStr += ' type="' + this.params["type"] + '"'; 
  314.     
  315.     if (isHostActiveXCompatible()){
  316.         htmlStr += ' classid="' + this.params["classid"] + '"';
  317.     }
  318.  
  319.     htmlStr += ' archive="' + this.params["archive"] + '"';
  320.  
  321.     htmlStr += ' height="' + this.params["height"] + '"';
  322.     htmlStr += ' width="' + this.params["width"] + '"';
  323.     htmlStr += ' alt="' + this.params["alt"] + '"';
  324.     
  325.     if (this.params["isApplet"] == "true")
  326.         htmlStr += ' title="' + this.params["alt"] + '"';
  327.     
  328.     htmlStr += '>\n'
  329.  
  330.     htmlStr += '<param name="code" value="' + this.params["code"] + '"/>\n';
  331.     htmlStr += '<param name="codebase" value="' + this.params["appletCodebase"] + '"/>\n'; 
  332.     htmlStr += '<param name="archive" value="' + this.params["archive"] + '"/>\n';
  333.     // process custom params
  334.     subParams = this.params["customParams"].split(";");
  335.  
  336.     if (subParams.length > 0){    
  337.         for (i = 0; i < subParams.length; i++){
  338.             if (subParams[i] != "" || subParams[i] != ''){
  339.                 tempArray = subParams[i].split("|");
  340.                 htmlStr += '<param name="' + tempArray[0] + '" value="' + tempArray[1] + '"/>\n';
  341.             }    
  342.         }
  343.     }
  344.     
  345.     htmlStr += '</object>';
  346.     return htmlStr;    
  347.     
  348. }
  349.  
  350.  
  351. function ShockwaveDirectorPlugin(mimeType, params){
  352.     this.mimeType = mimeType;
  353.     this.params = params;
  354. }
  355.  
  356. /**
  357.  * generates HTML code for the Shockwave Director plugin
  358.  *
  359.  */
  360. ShockwaveDirectorPlugin.prototype.toHTML = function(){
  361.     htmlStr = "";
  362.     
  363.     htmlStr += '<object name="' + this.params["name"] + '"'; 
  364.     htmlStr += ' id="' + this.params["name"] + '"';
  365.     
  366.     if (isHostActiveXCompatible()){
  367.         htmlStr += ' codebase="' + this.params["pluginCodebase"] + '"'; 
  368.     }
  369.     
  370.     htmlStr += ' type="' + this.mimeType + '"'; 
  371.     
  372.     if (isHostActiveXCompatible()){
  373.         htmlStr += ' classid="' + this.params["classid"] + '"';
  374.     }
  375.     
  376.     htmlStr += ' data="' + this.params["src"] + '" ';
  377.     htmlStr += ' height="' + this.params["height"] + '"';
  378.     htmlStr += ' width="' + this.params["width"] + '"';
  379.     htmlStr += ' alt="' + this.params["alt"] + '"';
  380.     
  381.     if (this.params["isApplet"] == "true")
  382.         htmlStr += ' title="' + this.params["alt"] + '"';
  383.     
  384.     htmlStr += '>\n'
  385.  
  386.     htmlStr += '<param name="src" value="' + this.params["src"] + '"/>\n'; 
  387.     htmlStr += '<param name="codebase" value="' + '.' + '"/>\n';     
  388.     htmlStr += '<param name="swURL" value="' + this.params["swURL"] + '"/>\n';
  389.     htmlStr += '<param name="swText" value="' + this.params["swText"] + '"/>\n';
  390.     htmlStr += '<param name="swColor" value="' + this.params["swColor"] + '"/>\n';
  391.     htmlStr += '<param name="swForeColor" value="' + this.params["swForeColor"] + '"/>\n';
  392.     htmlStr += '<param name="swBackColor" value="' + this.params["swBackColor"] + '"/>\n';
  393.     htmlStr += '<param name="swFrame" value="' + this.params["swFrame"] + '"/>\n';
  394.     htmlStr += '<param name="swName" value="' + this.params["swName"] + '"/>\n';
  395.     htmlStr += '<param name="swPassword" value="' + this.params["swPassword"] + '"/>\n';
  396.     htmlStr += '<param name="swBanner" value="' + this.params["swBanner"] + '"/>\n';
  397.     htmlStr += '<param name="swSound" value="' + this.params["swSound"] + '"/>\n';
  398.     htmlStr += '<param name="swPreload" value="' + this.params["swPreload"] + '"/>\n';
  399.     htmlStr += '<param name="swVolume" value="' + this.params["swVolume"] + '"/>\n';
  400.     htmlStr += '<param name="swList" value="' + this.params["swList"] + '"/>\n';
  401.     
  402.     htmlStr += '<param name="SW1" value="' + this.params["sw1"] + '"/>\n';
  403.     htmlStr += '<param name="SW2" value="' + this.params["sw2"] + '"/>\n';
  404.     htmlStr += '<param name="SW3" value="' + this.params["sw3"] + '"/>\n';
  405.     htmlStr += '<param name="SW4" value="' + this.params["sw4"] + '"/>\n';
  406.     htmlStr += '<param name="SW5" value="' + this.params["sw5"] + '"/>\n';
  407.     htmlStr += '<param name="SW6" value="' + this.params["sw6"] + '"/>\n';
  408.     htmlStr += '<param name="SW7" value="' + this.params["sw7"] + '"/>\n';
  409.     htmlStr += '<param name="SW8" value="' + this.params["sw8"] + '"/>\n';
  410.     htmlStr += '<param name="SW9" value="' + this.params["sw9"] + '"/>\n';
  411.     
  412.     htmlStr += '</object>';
  413.  
  414.     return htmlStr;    
  415.     
  416. }